/*
 * Copyright (c) 2012-2014 The original author or authors
 * ------------------------------------------------------
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 * The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * The Apache License v2.0 is available at
 * http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */
package org.dna.mqtt.moquette.processor.impl;

import org.dna.mqtt.moquette.messaging.spi.impl.ValueEvent;
import org.dna.mqtt.moquette.processor.ProtocolProcessor;
import org.dna.mqtt.moquette.proto.messages.Message;
import org.dna.mqtt.moquette.server.ServerChannel;

/**
 * Base class for protocol processor that handles common protocol operations.
 * @author puran
 */
public class AbstractProtocolProcessor implements ProtocolProcessor {

	private ServerChannel m_session;
	private Message m_message;
	private MqttProtocolProcessor m_baseProcessor;
	
	public AbstractProtocolProcessor() {}
    
	public AbstractProtocolProcessor(ServerChannel session) {
		this.m_session = session;
	}
	
    public AbstractProtocolProcessor(ServerChannel session, Message message) {
    	this.m_session = session;
    	this.m_message = message;
    }
    
	/**
	 * @return the m_session
	 */
    protected ServerChannel getSession() {
		return m_session;
	}
	/**
	 * @return the m_message
	 */
    protected Message getMessage() {
		return m_message;
	}
    
    protected String getClientID() {
    	return m_session.getClientID();
    }
    
	/**
	 * @return the m_protocolHandler
	 */
    protected MqttProtocolProcessor getBaseProcessor() {
		return m_baseProcessor;
	}
    
	@Override
	public void setBaseProcessor(MqttProtocolProcessor baseProcessor) {
		this.m_baseProcessor = baseProcessor;
	}
	
	@Override
	public void processEvent(ValueEvent valueEvent) {
		
	}
}
